import { useState,useEffect } from 'react';
import { observer } from 'mobx-react';
import { runInAction } from 'mobx';
import { useNavigate } from "react-router-dom";
import store from '@/store/public';
import { getUserInfo } from '@/api/index';
import style from '@/pages/index/index.module.css';


function Index(){
	let [ count,setCount ] = useState(1);
	const navigate = useNavigate();
	function Go(){
		navigate('/futures')
	}

	useEffect(() => {
		async function get(){
			let res = await getUserInfo();
			console.log(res)
		}
		const timer = setTimeout(get)
		return () => clearTimeout(timer)
	},[count]);
	// setTimeout(()=>{
	// 	runInAction(()=>{
	// 		store.theme = 'light';
	// 	})
	// },2000)
	return (
		<>
			<div className={'font-bold '+style.main} onClick={Go}>go to futures</div>
		</>
	)
}

export default observer(Index)